package top.wshape1.shiziapi.uaa.domain.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import top.wshape1.shiziapi.common.group.uaa.CodeGroup;
import top.wshape1.shiziapi.common.group.uaa.LoginGroup;
import top.wshape1.shiziapi.common.group.uaa.RegGroup;
import top.wshape1.shiziapi.common.group.uaa.ResetGroup;

import java.io.Serializable;

/**
 * @author Wshape1
 * @version 1.0
 * @description
 * @since 2023-08-22
 */

@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UserLoginVo implements Serializable {

    @NotNull(groups = {ResetGroup.class})
    private Long id;

    @Email(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$", groups = {ResetGroup.class, LoginGroup.class, CodeGroup.class, RegGroup.class})
    @NotBlank(groups = {ResetGroup.class, LoginGroup.class, CodeGroup.class, RegGroup.class})
    private String email;

    @NotBlank(groups = {ResetGroup.class, LoginGroup.class, RegGroup.class})
    @Pattern(regexp = "^[a-zA-Z0-9]*$", groups = {ResetGroup.class, LoginGroup.class, RegGroup.class}, message = "密码格式错误")
    private String password;

    @NotBlank(groups = {ResetGroup.class, CodeGroup.class, RegGroup.class})
    private String code;

}
